<template>
    <div class="dislike-button" @mouseover="changeColor" @mouseleave="resetColor">
        <i slot="reference" class="el-icon-close"  style="color: #c9cdd4"></i>
        <DislikeReason v-bind="$attrs" v-show="reasonVisible"/>
    </div>  
</template>

<script>
import DislikeReason from './DislikeReason.vue';
export default {
    data() {
        return {
            reasonVisible: false,
        }
    },
    methods: {
        changeColor(e) {
            if (e.target.className === 'dislike-button') {
                e.target.firstChild.style.color = "#007fff";
                this.reasonVisible = true;
            }
        },
        resetColor(e) {
            // console.log(e.target);
            e.target.firstChild.style.color = "#c9cdd4";
            this.reasonVisible = false;
        },
    },
    components: { DislikeReason }
}
</script>

<style>
.dislike-button {
    position: absolute;
    right: 1.667rem;
    transition: all .15s linear;
}
.dislike-button:after {
    display: block;
    content: " ";
    position: absolute;
    padding: 10px;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform: translate(-10px, -10px);
}
.dislike-button {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-size: 100% 100%;
    cursor: pointer;
}

@media screen and (max-width: 960px) {
    .entry .dislike-button {
        display: block;
    }
}

</style>